#pragma once

#define DAC_BUF_LEN		8192

class CDAC
{
protected:
	int VolumeTable_Signed[256];
	int VolumeTable_Unsigned[256];
	int CurOutput[4];
	u16 Buffer[DAC_BUF_LEN];
	int BufStart,BufOffset;
protected:
	void BuildTables();
public:
	CDAC();
	~CDAC();
	void Reset();
	void Write(u32 n,u8 data);
	void WriteSigned(u32 n,u8 data);
	void Update(u32 n,s16 *buf,int len);
	void UpdateSample();
	void UpdateSamples(int n);
};
